import { Configuration, ConnectionApi, DatabaseApi, CollectionApi } from "@linksaas-minapp/mongo-proxy-api";


export function getConnectionApi(): ConnectionApi {
    return new ConnectionApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.mongoProxyAddr,
    }));
}

export function getDatabaseApi(): DatabaseApi {
    return new DatabaseApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.mongoProxyAddr,
    }));
}

export function getCollectionApi(): CollectionApi {
    return new CollectionApi(new Configuration({
        // eslint-disable-next-line @typescript-eslint/no-explicit-any
        basePath: "http://" + (window as any).minApp.mongoProxyAddr,
    }));
}

export function getToken(): string {
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    return (window as any).minApp.mongoProxyToken ?? "";
}